package com.javacoo.xservice.base.setting;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import lombok.Data;

/**
 * Redis相关配置
 * <p>说明:</p>
 * <li>对应application-*.properties中spring.redis</li>
 * @author DuanYong
 * @since 2017年7月28日上午9:02:32
 */
@Data
@Component
@ConfigurationProperties(prefix = "spring.redis")
public class RedisSetting {
	/** Redis服务器地址:,默认值*/
	public static final String DEFAULT_HOST = "172.17.123.140";
	/** Redis服务器连接端口:,默认值*/
	public static final int DEFAULT_PORT = 6379;
	/** Redis服务器连接密码:,默认值*/
	public static final String DEFAULT_PASSWORD = "";
	/** 连接超时时间（毫秒）:,默认值*/
	public static final int DEFAULT_TIMEOUT = 0;
	/** 可缓存超时时间（秒）:,默认值,1小时*/
	public static final Integer DEFAULT_EXPIRATION = 60 * 60 * 1;
	/** 是否捕获异常,默认值*/
	public static final boolean DEFAULT_CATCH_EXCEPTION = false;
	/** 是否是集群模式,默认值*/
	public static final boolean DEFAULT_CLUSTER_MODE = true;
	
	/**Redis服务器地址*/
    private String host = DEFAULT_HOST;
    /**Redis服务器连接端口*/
    private int port = DEFAULT_PORT;
    /**Redis服务器连接密码（默认为空）*/
    private String password = DEFAULT_PASSWORD;
    /**连接超时时间（毫秒）*/
    private int timeout = DEFAULT_TIMEOUT;
    /**缓存超时时间（秒）*/
    private Integer expiration = DEFAULT_EXPIRATION;
    /**是否捕获异常*/
    private Boolean catchException = DEFAULT_CATCH_EXCEPTION;
    /**是否捕获异常*/
    private Boolean clusterMode = DEFAULT_CLUSTER_MODE;
}
